<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
	</head>
	<body>
		<script>
			Function.prototype.es3Call = function (context) {
			   var content = context || window;
			   console.log('this,',this)
			   content.fn = this;
			   var args = [];
			  // console.log(arguments.length)
			   // arguments是类数组对象，遍历之前需要保存长度，过滤出第一个传参
			   for (var i = 1, len = arguments.length ; i < len; i++) {
			      // 避免object之类传入
			      args.push('arguments[' + i + ']');
			    }
				//console.log(args)
				//console.log('content.fn('+args+')')
			   var result = eval('content.fn('+args+')');
			  // console.log(result)
			   delete content.fn;
			   return result;
			 }
			 function func(a,b){
			     console.log(this);
				// return a + b;
			 }
			// func.es3Call(func);     //输出func
			// func.es3Call.es3Call(func); //输出window
			
			
			
			function fn1(){
			   console.log(1);
			}
			function fn2(){
			    console.log(2);
			}
			
			//fn1.es3Call(fn2);     //输出 1
			fn1.es3Call.es3Call(fn2);  //输出 2
			
		</script>
	</body>
</html>